package com.doudou.base.resources.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.doudou.commons.entity.BaseEntity;
import lombok.Data;

import java.io.Serializable;

/**
 *
 * @author 傻男人
 * @since 2020-05-08
 */
@Data
@TableName(value = "oauth_client_details",resultMap = "BaseResultMap")
public class AppClientDetails extends BaseEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId
	private Long id;

    /**
     * 应用名字
     */
    @TableId("name")
    private String name;

    /**
     * 用于唯一标识每一个客户端(client)
     */
    @TableField("client_id")
	private String clientId;
    /**
     * 客户端能访问的资源id集合，注册客户端时，根据实际需要可选择资源id，也可以根据不同的额注册流程，赋予对应的额资源id
     */
	@TableField("resource_ids")
	private String resourceIds;
    /**
     * 注册填写或者服务端自动生成
     */
	@TableField("client_secret")
	private String clientSecret;
    /**
     * 指定client的权限范围
     */
	private String scope;
    /**
     * 授权模式
     */
	@TableField("authorized_grant_types")
	private String authorizedGrantTypes;
    /**
     * 客户端重定向uri
     */
	@TableField("web_server_redirect_uri")
	private String webServerRedirectUri;
    /**
     * 指定用户的权限范围
     */
	private String authorities;
    /**
     * 设置access_token的有效时间(秒)
     */
	@TableField("access_token_validity")
	private Integer accessTokenValidity;
    /**
     * 设置refresh_token有效期(秒)
     */
	@TableField("refresh_token_validity")
	private Integer refreshTokenValidity;
    /**
     * 值必须是json格式
     */
	@TableField("additional_information")
	private String additionalInformation;
    /**
     * 默认false,适用于authorization_code模式,设置用户是否自动approval操作,设置true跳过用户确认授权操作页面，直接跳到redirect_uri
     */
	private String autoapprove;

	public class Meta {
        public static final String id = "id";
        public static final String name = "name";
        public static final String clientId = "client_id";
        public static final String resourceIds = "resource_ids";
        public static final String clientSecret = "client_secret";
        public static final String scope = "scope";
        public static final String authorizedGrantTypes = "authorized_grant_types";
        public static final String webServerRedirectUri = "web_server_redirect_uri";
        public static final String authorities = "authorities";
        public static final String accessTokenValidity = "access_token_validity";
        public static final String refreshTokenValidity = "refresh_token_validity";
        public static final String additionalInformation = "additional_information";
        public static final String autoapprove = "autoapprove";
        public static final String createDate = "CREATE_DATE";
        public static final String updateDate = "UPDATE_DATE";
        public static final String delFlag = "del_flag";
    }
}